package sol.leetcode;

/**
 * Valid Anagram
 * Created by lkk on 2016/8/28.
 */
public class Issue242 {
    public static boolean isAnagram(String s, String t) {
        int[] count = new int[26];
        for (char c : s.toCharArray())
            count[c - 'a']++;
        for (char c : t.toCharArray())
            count[c - 'a']--;
        for (int i : count)
            if (i != 0) return false;
        return true;
    }

    public static void main(String[] args) {
        System.out.println(isAnagram("anagram", "nagaram"));
    }
}
